package cn.yangliu.nacos.management.repository.oauth2;

import cn.yangliu.jpa.base.repository.BaseRepository;
import cn.yangliu.nacos.management.entity.oauth2.Oauth2Client2Role;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * The type of nacos.
 *
 * @author 问道于盲
 * @date 2020 -01-01
 */
public interface Oauth2Client2RoleRepository extends BaseRepository<Oauth2Client2Role, Oauth2Client2Role.Oauth2Client2RoleKey> {

    /**
     * Delete by role id.
     *
     * @param roleId the role id
     */
    @Query("delete from Oauth2Client2Role where id.roleId=:roleId")
    @Modifying
    void deleteByRoleId(Long roleId);

    /**
     * Delete by client id.
     *
     * @param clientId the client id
     */
    @Query("delete from Oauth2Client2Role where id.clientId=:clientId")
    @Modifying
    void deleteByClientId(Long clientId);
}
